package com.chhuang.core.service;

import com.chhuang.core.bean.QueryBean;
import com.chhuang.core.mapper.IBaseMapper;
import com.chhuang.core.model.Persistable;

public interface IBaseService <TMapper extends IBaseMapper<TPo>, TPo extends Persistable>{
	
	/**
	 * 根据id查找对象
	 * @param id
	 * @return
	 */
	public TPo findByPrimaryKey(String id) throws Exception;
	
	/**
	 * 保存对象
	 * @param entity
	 * @return
	 */
	public int save(TPo entity) throws Exception;
	
	/**
	 * 选择性地保存对象属性，空的属性就不保存
	 * @param entity
	 * @return
	 */
	public int saveSelective(TPo entity) throws Exception;
	
	/**
	 * 保存或修改对象
	 * @param entity
	 * @return
	 */
	public int saveOrUpdate(TPo entity) throws Exception;
	
	/**
	 * 选择性地保存或修改对象属性，空的属性就不保存
	 * @param entity
	 * @return
	 */
	public int saveOrUpdateSelective(TPo entity) throws Exception;
	
	/**
	 * 修改对象
	 * @param entity
	 * @return
	 */
	public int update(TPo entity) throws Exception;
	
	/**
	 * 选择性地修改对象属性，空的属性就不保存
	 * @param entity
	 * @return
	 */
	public int updateSelective(TPo entity) throws Exception;
	
	/**
	 * 根据id删除对象
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;
	
	/**
	 * 多功能单表分页查询
	 * @param userQueryBean
	 * @return
	 * @throws Exception
	 */
	public QueryBean<TPo> seniorQuery(QueryBean<TPo> queryBean) throws Exception;
}
